package eerbaar.client.internal.ctr.cmd;

import eerbaar.client.ctr.IPersonaCmd;
import eerbaar.game.IGame;
import eerbaar.persona.IPersona;
import eerbaar.position.IPosition;
import eerbaar.position.PositionFactory;
import eerbaar.position.WrongPositionException;

public class IncrementYCmd implements IPersonaCmd {

    @Override
    public IPosition calcDestination(IGame game, IPersona persona)
            throws WrongPositionException {

        IPosition p = persona.getPosition();
        int x = p.getX();
        int y = p.getY();
        y++;
        return PositionFactory.createPosition(x, y);
    }

    @Override
    public boolean execute(IGame game, IPersona player)
            throws WrongPositionException {

        IPosition position = player.getPosition();
        position.incrementY();
        return true;
    }

    @Override
    public String toString() {
        return ":incrementy";
    }

}
